﻿using System.Reflection;
using Xunit;

namespace Gamemaster.Naming
{
    public class InjectDummyDatabase : BeforeAfterTestAttribute
    {
        private INameDatabaseFactory original;

        public override void Before(MethodInfo methodUnderTest)
        {
            original = Names.DatabaseFactory;
            Names.DatabaseFactory = new DummyDatabaseFactory();
        }

        public override void After(MethodInfo methodUnderTest)
        {
            Names.DatabaseFactory = original;
        }
    }
}
